<?php require('connections/con_gl.php'); ?>
<?php
cekAkses($_SESSION[akses],"PD-2");
mysql_select_db($database_con_gl, $con_gl);
$query_edit = "SELECT gl_stok.id, gl_stok.stok, gl_stok.fisik, gl_gudang.gudang, gl_barang.barang, gl_satuan.satuan FROM gl_stok, gl_gudang, gl_barang, gl_satuan WHERE gl_gudang.id=gl_stok.gudang AND gl_barang.id=gl_stok.barang AND gl_satuan.id=gl_stok.satuan AND gl_stok.id='$_GET[id]'";
$edit = mysql_query($query_edit, $con_gl) or die(mysql_error());
$row_edit = mysql_fetch_assoc($edit);
$totalRows_edit = mysql_num_rows($edit);
?>
<script type="text/javascript">
$(document).ready(function() {

	$().ajaxStart(function() {
		$('#loading').show();
		$('#result').hide();
	}).ajaxStop(function() {
		$('#loading').hide();
		$('#result').fadeIn('slow');
	});

	$('#editstok').submit(function() {
		$.ajax({
			type: 'POST',
			url: $(this).attr('action'),
			data: $(this).serialize(),
			success: function(data) {
				$('#result').html(data);
			}
		})
		return false;
	});
  $('#result').click(function(){
  $(this).hide();
  });
})
</script>
<div id="loading" style="display:none;"><img src="images/loading.gif" alt="loading..." /></div>
<div id="result" style="display:none;"></div>
<h1>Edit Stok</h1>
<form action="proses/stokopname.php?act=edit" method="POST" name="editstok" id="editstok">
  <table width="90%" border="0" align="center" cellpadding="5" cellspacing="0" class="datatable">
    <tr valign="top">
      <td width="17%" align="right" bgcolor="#FFFFFF">Lokasi Kantor : </td>
      <td width="83%" bgcolor="#FFFFFF"><?php echo $row_edit['gudang']; ?></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF">Barang : </td>
      <td bgcolor="#FFFFFF"><?php echo $row_edit['barang']; ?></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF">Satuan : </td>
      <td bgcolor="#FFFFFF"><?php echo $row_edit['satuan']; ?></td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Stok (buku) *: </td>
      <td bgcolor="#FFFFFF"><label>
        <input name="buku" type="text" id="buku" value="<?php echo intval($row_edit['stok']); ?>" size="10" maxlength="10" />
      (number only) </label></td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Stok (fisik) *: </td>
      <td bgcolor="#FFFFFF"><label>
        <input name="fisik" type="text" id="fisik" value="<?php echo intval($row_edit['fisik']); ?>" size="10" maxlength="10" /> 
        (number only) 
      </label></td>
    </tr>
    <tr>
      <td align="left" bgcolor="#FFFFFF"><em>*Harus diisi</em></td>
      <td bgcolor="#FFFFFF"><input name="Save" type="submit" id="Save" value="Simpan" />
          <input name="id" type="hidden" id="id" value="<?php echo $row_edit['id']; ?>" /></td>
    </tr>
  </table>
  </form>
